package com.leessy.r229.kt

import com.google.gson.Gson

/**
 * @author : Created by liucheng. on 2021/01/06
 * @description : -
 */

private val mGson by lazy {
    Gson()
}


fun Any.toJsonString(): String {
    return mGson.toJson(this)
}

fun <T> String.fromJson(s: Class<T>): T? {
    return try {
        mGson.fromJson(this, s)
    } catch (e: Exception) {
        null
    }
}

